package org.afs.gescol.component.edt.gwt.server.service;

import java.util.Date;
import java.util.List;

import org.afs.gescol.component.edt.gwt.client.service.EdtServicesGwt;
import org.afs.gescol.component.edt.gwt.server.service.mock.GetServicesMock;

import com.bradrydzewski.gwt.calendar.client.Appointment;

/**
 * GetServicesGwt implementation.
 * @autor Kobla GBENYO (kobla.gbenyo@gmail.com)
 */
public final class EdtServicesGwtImpl implements EdtServicesGwt {

    @Override
    public List<Appointment> getEdtContents(Long idAnnee, Long idPeriode, Long idClass) {
        final Date edtCurrentDate = new Date();
        edtCurrentDate.setDate(edtCurrentDate.getDate() - edtCurrentDate.getDay() + 1);
        // TODO rechercher si l'objet existe déjà en session
//        final DocContentsModel doc = new DocContentsModel();
//        doc.setTitle("Grand titre");
//        doc.setSecondTitle("Sous titre");
//        ServletUtils.getRequest().getSession().setAttribute(GlobalConstantesModel.EDT_DOC, doc);
        return GetServicesMock.getEdtContents((idClass.equals(1l)) ? edtCurrentDate : new Date());
    }

}